<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div sec:authorize="isAnonymous()">
    <a th:href="@{/login}">登录</a>
</div>

<div sec:authorize="isAuthenticated()">
    <p>
        <span sec:authentication="name"></span>
        你好
    </p>
    <a th:href="@{/logout}">注销</a>
</div>

<div sec:authorize="hasRole('common')">
    <h3>普通电影</h3>
    <ul>
        <li><a th:href="@{/common/1}">建国大业</a></li>
        <li><a th:href="@{/common/2}">建党伟业</a></li>
    </ul>
</div>

<div sec:authorize="hasRole('vip')">
    <h3>VIP专区</h3>
    <ul>
        <li><a th:href="@{/vip/1}">战狼</a></li>
        <li><a th:href="@{/vip/2}">战狼2</a></li>
    </ul>
</div>


</body>
</html>